import tensorflow as tf
import numpy as np


if __name__ == '__main__':

    model = tf.keras.Sequential([
        tf.keras.layers.Dense(units=1, input_shape=[1]),
    ])

    model.compile(optimizer='SGD', loss=tf.keras.losses.mean_squared_error)

    xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float)
    ys = np.array([-3.0, -1.0, 1.0, 3.0, 5.0, 7.0], dtype=float)

    model.fit(x=xs, y=ys, epochs=500)

    res = model.predict([10.0])

    print(res)